package com.bbeginner.learn;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.bbeginner.learn.no1.CalculatorActivity;
import com.bbeginner.learn.no1.Main1Activity;
import com.bbeginner.learn.no2.Main2Activity;
import com.bbeginner.learn.no2.layout.RelativeXmlActivity;
import com.bbeginner.learn.no2.practice.AlertActivity;
import com.bbeginner.learn.no2.practice.LoginMainActivity;
import com.bbeginner.learn.no2.practice.MortgageActivity;
import com.bbeginner.learn.no3.Main3Activity;
import com.bbeginner.learn.no4.Main4Activity;
import com.bbeginner.learn.no4.practice.ShoppingCartActivity;
import com.bbeginner.learn.no6.Main6Activity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.btn_control_1).setOnClickListener(this);
        findViewById(R.id.btn_control_2).setOnClickListener(this);
        findViewById(R.id.btn_control_3).setOnClickListener(this);
        findViewById(R.id.btn_strorage).setOnClickListener(this);
        findViewById(R.id.btn_network).setOnClickListener(this);


        project();
    }

    private void project() {
        Button btn_calculator = (Button) findViewById(R.id.btn_calculator);
        btn_calculator.setOnClickListener(this);

        findViewById(R.id.btn_alert).setOnClickListener(this);
        findViewById(R.id.btn_mortgage).setOnClickListener(this);
        findViewById(R.id.btn_login).setOnClickListener(this);
        findViewById(R.id.btn_shopping_cart).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.btn_control_1) {
            Intent intent = new Intent(this, Main1Activity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_control_2) {
            Intent intent = new Intent(this, Main2Activity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_control_3) {
            Intent intent = new Intent(this, Main3Activity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_strorage) {
            Intent intent = new Intent(this, Main4Activity.class);
            startActivity(intent);
        }else if (v.getId() == R.id.btn_network) {
            Intent intent = new Intent(this, Main6Activity.class);
            startActivity(intent);
        }


        /**
         * Project
         */
        else if (v.getId() == R.id.btn_calculator) {
            Intent intent = new Intent(this, CalculatorActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_alert) {
            Intent intent = new Intent(this, AlertActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_mortgage) {
            Intent intent = new Intent(this, MortgageActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_login) {
            Intent intent = new Intent(this, LoginMainActivity.class);
            startActivity(intent);
        } else if (v.getId() == R.id.btn_shopping_cart) {
            Intent intent = new Intent(this, ShoppingCartActivity.class);
            startActivity(intent);
        }


    }
}